#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
class Solution
{
public:
    int evalRPN(vector<string>& tokens)
    {
        stack<int> nst;
        for (int i = 0;i < tokens.size();i++)
        {
            string& token = tokens[i];
            if (!(token == "+" || token == "-" || token == "*" || token == "/"))
            {
                nst.push(atoi(token.c_str()));
            }
            else
            {
                int n2 = nst.top();
                nst.pop();
                int n1 = nst.top();
                nst.pop();
                switch (token[0])
                {
                case '+':
                    nst.push(n1 + n2);
                    break;
                case '-':
                    nst.push(n1 - n2);
                    break;
                case '*':
                    nst.push(n1 * n2);
                    break;
                case '/':
                    nst.push(n1 / n2);
                    break;
                }
            }
        }
        return nst.top();
    }
};
